package com.fenghongzhang.broadcasttest;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


    }

    public void send(View view) {

        //设置频道
        Intent intent = new Intent();
        intent.setAction("com.feng");

        //加数据
        Bundle bundle = new Bundle();
        bundle.putString("name","程小姐");
        intent.putExtras(bundle);

        sendBroadcast(intent);

    }
}
